# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-pg_roaringbitmap
_projname=pg_roaringbitmap
pkgver=0.5.4
pkgrel=1
pkgdesc="RoaringBitmap extension for PostgreSQL"
url="https://github.com/ChenHuajun/pg_roaringbitmap"
arch="all"
license="Apache-2.0"
makedepends="postgresql-dev"
subpackages="$pkgname-bitcode"
source="https://github.com/ChenHuajun/pg_roaringbitmap/archive/v$pkgver/postgresql-roaringbitmap-$pkgver.tar.gz"
builddir="$srcdir/$_projname-$pkgver"
options="!check"  # tests require running PostgreSQL

build() {
	make
}

package() {
	depends="postgresql$(pg_config --major-version)"

	make DESTDIR="$pkgdir" install
}

bitcode() {
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$(pg_config --major-version)-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
93c90b7cda13593188f02cbb93b8bb9a3e1baa59d42929230323a89ca393e97a0f9e4a73e96eb7399f8f9354e3926a0f54c063b7fb69e5bd96691b382ebd6699  postgresql-roaringbitmap-0.5.4.tar.gz
"
